From: Matthias Clasen Date: Fri, 24 Mar 2023 15:29:38 +0000 (-0400) Subject: Fix up criticals from GdkGLTexture X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~59^2^2~506^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=5c558c00912795d7ae82c440ea7b0a790962651a;p=gtk4.git Fix up criticals from GdkGLTexture I broke this in 4291f27b562f58. I overlooked that there may not be a current context. --- diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c index 3a9e230afe..ece45ed28c 100644 --- a/gdk/gdkgltexture.c +++ b/gdk/gdkgltexture.c @@ -320,14 +320,17 @@ static void gdk_gl_texture_determine_format (GdkGLTexture *self) { GdkTexture *texture = GDK_TEXTURE (self); + GdkGLContext *context; GLint active_texture; GLint internal_format; GLint width, height; /* Abort if somebody else is GL-ing here... */ - if (!gdk_gl_context_is_shared (self->context, gdk_gl_context_get_current ()) || + context = gdk_gl_context_get_current (); + if (context == NULL || + !gdk_gl_context_is_shared (self->context, context) || /* ... or glGetTexLevelParameter() isn't supported */ - !gdk_gl_context_check_version (gdk_gl_context_get_current (), 0, 0, 3, 1)) + !gdk_gl_context_check_version (context, 0, 0, 3, 1)) { texture->format = GDK_MEMORY_DEFAULT; self->has_mipmap = FALSE;